package com.lmq.singleRespblty;

public class SingleResponsibility {
    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();
        vehicle.run("摩托车");
        vehicle.run("汽车");
        vehicle.run("飞机");

    }

}

// run方法违反单一职责原则
// solutions: 根据交通工具分解为不同的类
class Vehicle{
    public void run(String vehicle){
        System.out.println(vehicle + "在公路上运行...");
    }
}
